package com.example.publish_model.pushorpull;

import com.example.common.filed.DataActionEntity;
import com.example.common.mvvm.viewmodel.BaseViewModel;
import com.example.network_skd.BaseEntity;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class SendMsgViewModel extends BaseViewModel<SendMsgRepository> {
    @Override
    protected void initData() {

    }

    @Override
    protected void onResult(BaseEntity baseEntity) {
        if (baseEntity instanceof SendMsgEntity){

        }
    }

    public void sendMsg(int type , String msg){
        Map<String,Object> map = new HashMap<>();
        map.put("type", type);
        map.put("msg", msg);
        repository.sendMsg(map)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(this);
    }
}
